#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Ros libraries
import roslib
import rospy
import sys

import detector

# Ros Messages
from sensor_msgs.msg import CompressedImage
from geometry_msgs.msg import Pose

from imagetran.msg import Calibrationimage

from probot_vision.srv import *



def ThisToDetect(OBJECTYPE):
    rospy.wait_for_service('probot_detect_object')
    try:
        detect_object = rospy.ServiceProxy('probot_detect_object',DetectObjectSrv)
        resp1 = detect_object(OBJECTYPE)
        #print(resp1.redObjList)
        return resp1
    except rospy.ServiceException, e:
    	print("Service call failed: %s" %e)





if __name__ == '__main__':
    if len(sys.argv) == 2:
        OBJECTYPE = int(sys.argv[1])
    else:
        print("which type object do you want to deal?")
        sys.exit(1)
    print("detect type is %d" %(OBJECTYPE))
    print("detect result is ")
    resp1 = ThisToDetect(OBJECTYPE)
    print(resp1.result,resp1.redObjList,resp1.greenObjList,resp1.blueObjList,resp1.blackObjList)
